#include <iostream>
using std::cout;
using std::endl;

class Point{


public:
    Point(){
        cout << "Point::Point()" << endl;
    }

    Point(int x, int y)
    :_x(x)
    ,_y(y)
    {

    }

    void print(){
        cout << "Point::print" << endl;
    }

private:
    int _x;
    int _y;
};

//类和对象就可以看做是自定义类型
//自定义类型基本的表现形式和内置数据类型的表现形式是一样的
void test(){
    int a = 10;
    int * p1 = &a;
    int * p2 = new int();
    delete p2;
    Point pt;
    Point * p =  &pt;
    Point * pp = new Point();
    delete pp;
    p->print();
    (*p).print();
}

void test2(){
    //数组里面填充了2个Point对象
    //便会调用Point的无参构造函数创建出对象
    Point pts[2];

    //初始化传递右值
    Point pts2[3] = {Point(1, 2), Point(3, 4), Point(5, 6)};
    //初始化传递左值
    Point pt(1, 2), pt2(3, 4), pt3(5, 6);
    Point pts3[3] = {pt, pt2, pt3};
}

int main()
{
    test2();
    return 0;
}

